import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Input, Select } from 'antd';
import { cloneDeep } from 'lodash';
import { useEffect, useState } from 'react';
import styles from './inputConcatSelect.module.less';
const { Option } = Select;
const InputConcatSelect = (props) => {
    const { onChange, value = {}, options = [], keys = [] } = props;
    const [data, setData] = useState(value);
    const valueChange = (event, type) => {
        // console.log(date)
        const oData = cloneDeep(data);
        if (type === 'input') {
            oData[keys[0]] = event.target.value;
        }
        if (type === 'select') {
            oData[keys[1]] = event;
        }
        setData(oData);
    };
    useEffect(() => {
        onChange && onChange(data);
    }, [data]);
    return (_jsxs("div", { className: styles.concatBox, children: [_jsx(Input, { value: data[keys[0]], onChange: (event) => valueChange(event, 'input') }), _jsx(Select, { className: styles.select, value: data[keys[1]], onChange: (event) => valueChange(event, 'select'), children: options.map((item) => {
                    return (_jsx(Option, { value: item.value, children: item.label }, item.value));
                }) })] }));
};
export default InputConcatSelect;
